        NAME    main

		PUBLIC	__vector_table
		PUBLIC  __iar_program_start

        SECTION .intvec : CODE (2)
        THUMB
		
		DATA
__intial_sp      EQU     0x20006000
__vector_table
        DCD     __intial_sp
        DCD		__iar_program_start

        DCD     NMI_Handler               ; NMI Handler
        DCD     HardFault_Handler         ; Hard Fault Handler
        DCD     MemManage_Handler         ; MPU Fault Handler
        DCD     BusFault_Handler          ; Bus Fault Handler
        DCD     UsageFault_Handler        ; Usage Fault Handler
        DCD     0                         ; Reserved
        DCD     0                         ; Reserved
        DCD     0                         ; Reserved
        DCD     0                         ; Reserved
        
        DCD     SVC_Handler               ; SVCall Handler
;        DCD     vPortSVCHandler               ; SVCall Handler
        
        DCD     DebugMon_Handler          ; Debug Monitor Handler
        DCD     0                         ; Reserved
        
        DCD     PendSV_Handler            ; PendSV Handler
;        DCD     xPortPendSVHandler            ; PendSV Handler
        
        DCD     SysTick_Handler				;SysTick_Handler           ; SysTick Handler
;        DCD     xPortSysTickHandler				;SysTick_Handler           ; SysTick Handler
		
;-------------------------------------------Peripheral vectors
		DCD		LVDFAIL_Handler					;LVDFAIL_Handler				;0
		DCD		SYSCLKFAIL_Handler				;SYSCLKFAIL_Handler					;1
		DCD		XOSCFAIL_Handler				;XOSCFAIL_Handler					;2
		DCD		WDT_Handler						;WDT_Handler					;3
		DCD		NULL_Handler					;FRT_Handler					;4
		DCD		TIMER0_Handler					;TIMER0_Handler					;5
		DCD		TIMER1_Handler					;TIMER1_Handler					;6
		DCD		TIMER2_Handler					;TIMER2_Handler					;7
		DCD		TIMER3_Handler					;TIMER3_Handler					;8
		DCD		NULL_Handler					;TIMER4_Handler					;9
		DCD		NULL_Handler					;TIMER5_Handler					;10
		DCD		NULL_Handler					;TIMER6_Handler					;11
		DCD		NULL_Handler					;TIMER7_Handler					;12
		DCD		TIMER4_Handler					;TIMER8_Handler					;13
		DCD		TIMER5_Handler					;TIMER9_Handler					;14
		DCD		NULL_Handler					;15
		DCD		GPIOAE_Handler					;GPIOAE_Handler					;16
		DCD		GPIOAO_Handler					;GPIOAO_Handler					;17
		DCD		GPIOBE_Handler					;GPIOBE_Handler					;18
		DCD		GPIOBO_Handler					;GPIOBO_Handler					;19
		DCD		GPIOCE_Handler					;GPIOCE_Handler					;20
		DCD		GPIOCO_Handler					;GPIOCO_Handler					;21
		DCD		GPIODE_Handler					;GPIODE_Handler					;22
		DCD		GPIODO_Handler					;GPIODO_Handler					;23
		DCD		MPWM0_Handler					;PWM0_Handler					;24
		DCD		MPWM0PROT_Handler				;PWM1_Handler					;25
		DCD		MPWM0OVV_Handler				;PWM2_Handler					;26
		DCD		MPWM0_Handler					;PWM3_Handler					;27
		DCD		MPWM0PROT_Handler				;PWM4_Handler					;28
		DCD		MPWM0OVV_Handler				;PWM5_Handler					;29
		DCD		NULL_Handler					;PWM6_Handler					;30
		DCD		NULL_Handler					;PWM7_Handler					;31

		DCD		SPI0_Handler					;SPI0_Handler				;32
		DCD		SPI1_Handler					;SPI1_Handler					;33
		DCD		NULL_Handler					;34
		DCD		NULL_Handler					;35
		DCD		I2C0_Handler					;I2C0_Handler					;36
		DCD		I2C1_Handler					;I2C1_Handler					;37
		DCD		UART0_Handler					;UART0_Handler					;38
		DCD		UART1_Handler					;UART1_Handler					;39
		DCD		UART2_Handler					;UART2_Handler					;40
		DCD		UART3_Handler					;UART3_Handler					;41
		DCD		NULL_Handler					;42	
		DCD		ADC0_Handler					;ADC_Handler					;43
		DCD		ADC1_Handler					;44
		DCD		ADC2_Handler					;46
		DCD		NULL_Handler					;47
		DCD		NULL_Handler					;48
		DCD		NULL_Handler					;49
		DCD		NULL_Handler					;40
		DCD		NULL_Handler					;50
		DCD		NULL_Handler					;51
		DCD		NULL_Handler					;52
		DCD		NULL_Handler					;53
		DCD		NULL_Handler					;54
		DCD		NULL_Handler					;55
		DCD		NULL_Handler					;56
		DCD		NULL_Handler					;57
		DCD		NULL_Handler					;58
		DCD		NULL_Handler					;59
		DCD		NULL_Handler					;60
		DCD		NULL_Handler					;61
		DCD		NULL_Handler					;62
		DCD		NULL_Handler					;63

;//--------------------------------------------------------------------

        SECTION .text : CODE (2)
        THUMB



;//=====================================================================
		IMPORT	main

__iar_program_start
		ldr		r0,=__intial_sp
		mov		r13,r0
		
		B		main

		MOVW	r0,#0x0001
		MOVT	r0,#0x1FFF
		BX		r0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; Default interrupt handlers.
;;
        THUMB

        PUBWEAK NMI_Handler
        SECTION .text:CODE:REORDER(1)
NMI_Handler
        B NMI_Handler
        PUBWEAK HardFault_Handler
        SECTION .text:CODE:REORDER(1)
HardFault_Handler
        B HardFault_Handler
        PUBWEAK MemManage_Handler
        SECTION .text:CODE:REORDER(1)
MemManage_Handler
        B MemManage_Handler
        PUBWEAK BusFault_Handler
        SECTION .text:CODE:REORDER(1)
BusFault_Handler
        B BusFault_Handler
        PUBWEAK UsageFault_Handler
        SECTION .text:CODE:REORDER(1)
UsageFault_Handler
        B UsageFault_Handler
        PUBWEAK SVC_Handler
 ;       PUBWEAK vPortSVCHandler
        SECTION .text:CODE:REORDER(1)
SVC_Handler
       B SVC_Handler
;vPortSVCHandler
;        B vPortSVCHandler
        
        PUBWEAK DebugMon_Handler
        SECTION .text:CODE:REORDER(1)
DebugMon_Handler
        B DebugMon_Handler
        
        PUBWEAK PendSV_Handler
;        PUBWEAK xPortPendSVHandler        
        SECTION .text:CODE:REORDER(1)
PendSV_Handler
        B PendSV_Handler
;xPortPendSVHandler
;        B xPortPendSVHandler
        
        PUBWEAK SysTick_Handler
;        PUBWEAK xPortSysTickHandler        
        SECTION .text:CODE:REORDER(1)
SysTick_Handler
        B SysTick_Handler
;xPortSysTickHandler
;        B xPortSysTickHandler
        //PUBWEAK WWDG_IRQHandler
        SECTION .text:CODE:REORDER(1)

;//-------------------------------------------------------------------------------
//#define	IL_LVDFAIL		(0)
        PUBWEAK LVDFAIL_Handler
        SECTION .text:CODE:REORDER(1)
LVDFAIL_Handler
		B		.	;//        B 		LVDFAIL_Handler
;//#define	SYSCLKFAIL_Handler	(1)
        PUBWEAK SYSCLKFAIL_Handler
        SECTION .text:CODE:REORDER(1)
SYSCLKFAIL_Handler
        B		.
;//#define	XOSCFAIL_Handler	(2)
        PUBWEAK XOSCFAIL_Handler
        SECTION .text:CODE:REORDER(1)
XOSCFAIL_Handler
        B		.
;//#define	IL_WDT			(3)
        PUBWEAK WDT_Handler
        SECTION .text:CODE:REORDER(1)
WDT_Handler
		B		.
		
;//#define	IL_TIMER0		(5)
        PUBWEAK TIMER0_Handler
        SECTION .text:CODE:REORDER(1)
TIMER0_Handler
		B		.
;//#define	IL_TIMER1		(6)
        PUBWEAK TIMER1_Handler
        SECTION .text:CODE:REORDER(1)
TIMER1_Handler
        B		.	;//B 		TIMER1_Handler
;//#define	IL_TIMER2		(7)
        PUBWEAK TIMER2_Handler
        SECTION .text:CODE:REORDER(1)
TIMER2_Handler
        B		.	;//B 		TIMER2_Handler
;//#define	IL_TIMER3		(8)
        PUBWEAK TIMER3_Handler
        SECTION .text:CODE:REORDER(1)
TIMER3_Handler
        B		.	;//B 		TIMER3_Handler
;//#define	IL_TIMER4		(9)
        PUBWEAK TIMER4_Handler
        SECTION .text:CODE:REORDER(1)
TIMER4_Handler
        B		.	;//B 		TIMER4_Handler
;//#define	IL_TIMER5		(10)
        PUBWEAK TIMER5_Handler
        SECTION .text:CODE:REORDER(1)
TIMER5_Handler
        B		.	;//B 		TIMER5_Handler
;//#define	IL_TIMER6		(11)
        PUBWEAK TIMER6_Handler
        SECTION .text:CODE:REORDER(1)
TIMER6_Handler
        B		.	;//B 		TIMER6_Handler
;//#define	IL_TIMER7		(12)
        PUBWEAK TIMER7_Handler
        SECTION .text:CODE:REORDER(1)
TIMER7_Handler
        B		.	;//B 		TIMER7_Handler
;//#define	IL_TIEMR8		(13)
        PUBWEAK TIMER8_Handler
        SECTION .text:CODE:REORDER(1)
TIMER8_Handler
        B		.	;//B 		TIMER8_Handler
;//#define	IL_TIMER9		(14)
        PUBWEAK TIMER9_Handler
        SECTION .text:CODE:REORDER(1)
TIMER9_Handler
        B		.	;//B 		TIMER9_Handler
;////IL_15
		B		.		;NULL_Handler
;//#define	IL_GPIOA		(16)
        PUBWEAK GPIOAE_Handler
        SECTION .text:CODE:REORDER(1)
GPIOAE_Handler
		B		.	;//B		gpioa_handler
        PUBWEAK GPIOAO_Handler
        SECTION .text:CODE:REORDER(1)
GPIOAO_Handler
		B		.	;//B		gpioa_handler
;//#define	IL_GPIOB		(17)
        PUBWEAK GPIOBE_Handler
        SECTION .text:CODE:REORDER(1)
GPIOBE_Handler
        B		.	;//B 		GPIOB_Handler
        PUBWEAK GPIOBO_Handler
        SECTION .text:CODE:REORDER(1)
GPIOBO_Handler
        B		.	;//B 		GPIOB_Handler
;//#define	IL_GPIOC		(18)
        PUBWEAK GPIOCE_Handler
        SECTION .text:CODE:REORDER(1)
GPIOCE_Handler
        B		.	;//B 		GPIOC_Handler
        PUBWEAK GPIOCO_Handler
        SECTION .text:CODE:REORDER(1)
GPIOCO_Handler
        B		.	;//B 		GPIOC_Handler
;//#define	IL_GPIOD		(19)
        PUBWEAK GPIODE_Handler
        SECTION .text:CODE:REORDER(1)
GPIODE_Handler
        B		.	;//B 		GPIOD_Handler
        PUBWEAK GPIODO_Handler
        SECTION .text:CODE:REORDER(1)
GPIODO_Handler
        B		.	;//B 		GPIOD_Handler
;//IL_22
NULL_Handler
		B		.		;//NULL_Handler
;//IL_23
		B		.		;//NULL_Handler
;//#define	IL_PWM0			(24)
        PUBWEAK MPWM0_Handler
        SECTION .text:CODE:REORDER(1)
MPWM0_Handler
        B		.
        PUBWEAK MPWM0PROT_Handler
        SECTION .text:CODE:REORDER(1)
MPWM0PROT_Handler
        B		.
        PUBWEAK MPWM0OVV_Handler
        SECTION .text:CODE:REORDER(1)
MPWM0OVV_Handler
        B		.
;//#define	IL_PWM1			(25)
        PUBWEAK MPWM1_Handler
        SECTION .text:CODE:REORDER(1)
MPWM1_Handler
        B		.
        PUBWEAK MPWM1PROT_Handler
        SECTION .text:CODE:REORDER(1)
MPWM1PROT_Handler
        B		.
        PUBWEAK MPWM1OVV_Handler
        SECTION .text:CODE:REORDER(1)
MPWM1OVV_Handler
        B		.
//-----------------------------------NVIC_IEN[1]
;//#define	IL_SPI0			(32)
        PUBWEAK SPI0_Handler
        SECTION .text:CODE:REORDER(1)
SPI0_Handler
        B		.	;//B 		SPI0_Handler
;//#define	IL_SPI1			(33)
        PUBWEAK SPI1_Handler
        SECTION .text:CODE:REORDER(1)
SPI1_Handler
        B		.	;//B 		SPI1_Handler
;//#define	IL_SFC			(34)
        PUBWEAK SFC_Handler
        SECTION .text:CODE:REORDER(1)
SFC_Handler
        B		.	;//B 		SFC_Handler
;//IL_35
		B		.		;//NULL_Handler
;//#define	IL_I2C0			(36)
        PUBWEAK I2C0_Handler
        SECTION .text:CODE:REORDER(1)
I2C0_Handler
		B		.
;//#define	IL_I2C1			(37)
        PUBWEAK I2C1_Handler
        SECTION .text:CODE:REORDER(1)
I2C1_Handler
        B		.	;//B 		I2C1_Handler
;//#define	IL_UART0		(38)
        PUBWEAK UART0_Handler
        SECTION .text:CODE:REORDER(1)
UART0_Handler
        B		.
;//#define	IL_UART1		(39)
        PUBWEAK UART1_Handler
        SECTION .text:CODE:REORDER(1)
UART1_Handler
        B		.
;//#define	IL_UART2		(40)
        PUBWEAK UART2_Handler
        SECTION .text:CODE:REORDER(1)
UART2_Handler
		B		.
;//#define	IL_UART3		(41)
        PUBWEAK UART3_Handler
        SECTION .text:CODE:REORDER(1)
UART3_Handler
        B		.
;//IL_42
		B		.		;//NULL_Handler
;//#define	IL_ADC			(43)
        PUBWEAK ADC0_Handler
        SECTION .text:CODE:REORDER(1)
ADC0_Handler
        B		.
;//#define	IL_ADC			(43)
        PUBWEAK ADC1_Handler
        SECTION .text:CODE:REORDER(1)
ADC1_Handler
        B		.
;//#define	IL_ADC			(43)
        PUBWEAK ADC2_Handler
        SECTION .text:CODE:REORDER(1)
ADC2_Handler
        B		.

		
        END
